layui.use(['jquery', 'carousel', 'flipcountdown'], function (exports) {
    var $ = layui.jquery
        , carousel = layui.carousel;
    //轮播
    carousel.render({
        elem: '#layui-carousel',
        width: '930px', //设置容器宽度
        height: '350px',
        arrow: 'none', //始终显示箭头
        anim: 'fade' //切换动画方式
    });

    //时间插件
    $('#time').flipcountdown({
        speedFlip: 50
    });
    //阻止默认事件
    $(".main-top-right-center-tools li a").click(function (e) {
        var that = $(this);
        if (that.attr('href') === '') {
            e.preventDefault();
            layer.msg('功能正在开发中');
            return false;
        }
    });
    //天气插件
    (function (a, h, g, f, e, d, c, b) {
        b = function () {
            d = h.createElement(g);
            c = h.getElementsByTagName(g)[0];
            d.src = e;
            d.charset = "utf-8";
            d.async = 1;
            c.parentNode.insertBefore(d, c)
        };
        a["SeniverseWeatherWidgetObject"] = f;
        a[f] || (a[f] = function () {
            (a[f].q = a[f].q || []).push(arguments)
        });
        a[f].l = +new Date();
        if (a.attachEvent) {
            a.attachEvent("onload", b)
        } else {
            a.addEventListener("load", b, false)
        }
    }(window, document, "script", "SeniverseWeatherWidget", "//cdn.sencdn.com/widget2/static/js/bundle.js?t=" +
        parseInt((new Date().getTime() / 100000000).toString(), 10)));
    window.SeniverseWeatherWidget('show', {
        flavor: "slim",
        location: "WWE0TGW4PX6N",
        geolocation: false,
        language: "zh-Hans",
        unit: "c",
        theme: "auto",
        token: "79f3b5fa-e533-411d-aad7-9f043e316103",
        hover: "enabled",
        container: "tp-weather-widget"
    })
})
